package com.msb.controller;

import com.msb.pojo.Book;
import com.msb.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author wuJiaWei
 * @version 1.0
 */
@Controller
public class BookController {

    @Autowired
    private BookService bookService;

    @RequestMapping("/findBooks")
    @ResponseBody
    public String findBooks(){
        List allBooks = bookService.findAllBooks();
        String str = "";
        for (int i = 0; i < allBooks.size(); i++) {
            Book b = (Book)allBooks.get(i);
            str += b.getName()+"/";
        }
        return str;
    }
}
